package com.fyl.validation.anno;

import com.fyl.validation.RuleType;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target(FIELD)
@Retention(RUNTIME)
public @interface Validation {

    Rule[] rules();

    @Retention(RUNTIME)
    @Target({})
    @interface Rule {

        String message() default "Verification failed";

        RuleType type();

        /**
         * RuleType == REQUIRED
         * value = boolean, eq: false or true
         * <p>
         * RuleType == REGULAR
         * value = patten, eq: ^[+]{0,1}(\d+)$
         * <p>
         * RuleType == CUSTOM
         * value = method signature, eq: com.fyl.Util.TestClass.testFun
         *
         * @return
         */
        String value();

    }
}
